<?php
use Lib\Translit as Translit;

class Zend_View_Helper_Url_Auto extends Zend_View_Helper_Abstract{
private $_config;
    private $_request;
    
    /**
     * @todo Add some cache. Maybe from redis for transliteration result
     * Enter description here ...
     * @param unknown_type $autoId
     * @param unknown_type $markName
     * @param unknown_type $modelName
     */
    public function url_Auto($autoId, $markName=null, $modelName=null){
        if(!$markName or !$modelName){
            $auto = new \Managers\Auto();
            $info = $auto->getAutosInfo(array($autoId));
            $markName = $info[0]['mark']['name'];
            $modelName = $info[0]['model']['name'];
        }
        $markName  = strtolower(Translit::translit($markName, Translit::$CHAR_TABLE, Translit::$CHAR_FILTERS));
        $modelName = strtolower(Translit::translit($modelName, Translit::$CHAR_TABLE, Translit::$CHAR_FILTERS));
        return $this->view->url(array('1'=>$markName, '2'=>$modelName, '3'=>$autoId), 'car_general');
    }
}